using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using UwinEducation.Shared.Enums;

namespace UwinEducation.Application.Dtos.Orders
{
    /// <summary>
    /// 订单DTO
    /// </summary>
    public class OrderDto
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string OrderNumber { get; set; }

        /// <summary>
        /// 订单总金额
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 实付金额
        /// </summary>
        public decimal ActualAmount { get; set; }

        /// <summary>
        /// 支付状态
        /// </summary>
        public PaymentStatus PaymentStatus { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public OrderStatus OrderStatus { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedDate { get; set; }

        /// <summary>
        /// 订单说明
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 学生
        /// </summary>
        public StudentDto Student { get; set; }

        /// <summary>
        /// 订单详情列表
        /// </summary>
        public List<OrderDetailDto> OrderDetails { get; set; }

        /// <summary>
        /// 订单支付列表
        /// </summary>
        public List<OrderPaymentDto> OrderPayments { get; set; }

        /// <summary>
        /// 订单折扣列表
        /// </summary>
        public List<OrderDiscountDto> OrderDiscounts { get; set; }

        /// <summary>
        /// 预约列表
        /// </summary>
        public List<AppointmentDto> Appointments { get; set; }
    }

    /// <summary>
    /// 创建订单DTO
    /// </summary>
    public class CreateOrderDto
    {
        /// <summary>
        /// 学生ID
        /// </summary>
        [Required(ErrorMessage = "学生ID不能为空")]
        public Guid StudentId { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        [Required(ErrorMessage = "订单编号不能为空")]
        [StringLength(50, ErrorMessage = "订单编号长度不能超过50个字符")]
        public string OrderNumber { get; set; }

        /// <summary>
        /// 订单说明
        /// </summary>
        [StringLength(200, ErrorMessage = "订单说明长度不能超过200个字符")]
        public string? Description { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        [Required(ErrorMessage = "创建日期不能为空")]
        public DateTime CreatedDate { get; set; }

        /// <summary>
        /// 学期开始时间
        /// </summary>
        [Required(ErrorMessage = "学期开始时间不能为空")]
        public DateTime? SemesterStartDate { get; set; }

        /// <summary>
        /// 学期结束时间
        /// </summary>
        [Required(ErrorMessage = "学期结束时间不能为空")]
        public DateTime? SemesterEndDate { get; set; }
    }

    /// <summary>
    /// 更新订单DTO
    /// </summary>
    public class UpdateOrderDto
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        [Required]
        public Guid Id { get; set; }

        /// <summary>
        ///订单说明
        /// </summary>
        public string? Description { get; set; }
    }
}
